#!/bin/bash
# Installs the basic python which Plone will need

while getopts "f:d:p:" opt; do
  case $opt in
    f)
      PLONEFULLVERSION=$OPTARG
      ;;
    d)
     TARGETDIR=$OPTARG
      ;;
    p)
      PLONEVERSION=$OPTARG
      ;;
    \?)
      echo "Invalid option: -$OPTARG\
            use -p (e.g. -p 3.2) for Plone verion,\
             -f for full Plone version (e.g. -f 3.2.2)
             -d for target directory (e.g. /opt/Plone)" >&2
      end 0
      ;;
  esac
done
#export PLONEVERSION=3.2
#export PLONEFULLVERSION=3.2.2
echo Ploneversion is $PLONEVERSION
echo Plonefullversion is $PLONEFULLVERSION
sleep 2
wget http://launchpad.net/plone/$PLONEVERSION/$PLONEFULLVERSION/+download/Plone-$PLONEFULLVERSION-UnifiedInstaller.tgz -O Plone-$PLONEFULLVERSION-UnifiedInstaller.tgz
tar xvfz Plone-$PLONEFULLVERSION-UnifiedInstaller.tgz
cd Plone-$PLONEFULLVERSION-UnifiedInstaller
./install.sh standalone --target=$TARGETDIR --no-build 

